]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/bluetooth: Disconnect device signals on destroy
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 16 Mar 2025 00:57:55 +0000 (01:57 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 16 Mar 2025 01:27:58 +0000 (02:27 +0100)
Devices may outlive the corresponding menu item, for example on
shutdown. Make sure that signals are disconnected correctly in
that case to avoid warnings.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8223
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3669>

js/ui/status/bluetooth.js

index 794c08cbe89fddaf6fdc05c8788832cdd7edeace..90e7e9f4be8483eae1bee2391c6e2c3311c4d8a1 100644 (file)
@@ -248,8 +248,10 @@ class BluetoothDeviceItem extends PopupMenu.PopupBaseMenuItem {
 
         this.connect('destroy', () => (this._spinner = null));
         this.connect('activate', () => this._toggleConnected().catch(logError));
-        this._device.connect('notify::alias', () => this._updateAccessibleName());
-        this._device.connect('notify::connected', () => this._updateAccessibleName());
+        this._device.connectObject(
+            'notify::alias', () => this._updateAccessibleName(),
+            'notify::connected', () => this._updateAccessibleName(),
+            this);
         this._updateAccessibleName();
     }